// pages/message/message.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    messageList:[]
  },

    //------------------ 页面数据加载模块 start---------------------------
    onLoad:function(){
      this.getAllMessage();  // 加载考研资讯/考研热点
      
    },
    
    //------------------ 页面数据加载模块 end---------------------------


    //------------------功能模块 start----------------------
  // 获取考研资讯/考研热点数据
  getAllMessage:function(){
    var mark = 'getAllMessage';
    wx.request({
      url: 'http://localhost:8080/youYanZaiXian/MessageServlet',
      method: 'POST',
      data:{
        mark:mark,
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded',
        'Accept': 'application/json'
      },
      success: (res)=>{
        var messageList = res.data.data.messageList;
        this.setData({
          messageList:messageList,
        })
        //console.log(this.data.messageList)
      }
    });
  },

  //------------------功能模块 end----------------------

  // ----------------页面跳转功能块 start--------------------------------
  // 进入考研热点详情
  goMcontent:function(e){
    var mid = e.currentTarget.dataset.mid;
    var userid = e.currentTarget.dataset.userid;
    wx.navigateTo({
      url: '/pages/message/mContent/mContent?mid='+mid+'&userid='+userid,
    })
  }
  // ----------------页面跳转功能块 end--------------------------------
})